# \src\schemas\sys_dict_value.py
from pydantic import BaseModel, Field
from typing import Optional
from datetime import datetime


class SysDictValueBase(BaseModel):
    dict_code: str = Field(..., max_length=36, description="代码")
    dict_text: str = Field(..., max_length=36, description="名称")
    dict_id: str = Field(..., max_length=36, description="字典ID")
    sort: Optional[int] = Field(None, ge=0, description="排序")
    disabled: bool = Field(False, description="禁用")
    deletion_mark: bool = False
    deletion_reason: Optional[str] = None
    deletion_date: Optional[datetime] = None
    deletion_by: Optional[str] = None
    create_date: Optional[datetime] = None
    creator_by: Optional[str] = None
    last_updated_date: Optional[datetime] = None
    last_updated_by: Optional[str] = None
    description: Optional[str] = Field(None, max_length=128, description="说明描述")


class SysDictValueCreate(SysDictValueBase):
    api_id: Optional[str] = Field(None, max_length=36, description="API主键，用于关联其他系统")


class SysDictValue(SysDictValueBase):
    id: str
    api_id: str | None = None

    class Config:
        from_attributes = True
